<template>
  <div class="hello">
    <h1 class="h1" @click='open'>vuex内部demo</h1>
    <br>
    <br>
    <button @click="saveMoney(10000)">存钱</button>
    <p>我的余额：<span>{{money}}</span></p>
    </br>
    </br>
    </br>
    </br> 
    <router-link to="/bjyd">跳转到主页  (有权限)</router-link>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <router-link to="/center">跳转到个人中心   (没权限)</router-link>
  </div>
</template>
  
<script>
import {mapState,mapMutations,mapActions} from 'vuex';
// import Tag from 'iview/src/components/tag';
import {havePower,powerList} from '../../utils/index.js'

export default {
  name: 'loginLand',
  data () {
    return {
      fuck:"11"
    }
  },
  computed:{
    /*catch store.data*/
    ...mapState({
      money:state => state.login.money 
    })
  },
  methods:{
    /*catch store.mutation*/
    ...mapMutations(['setName','setAuthority']),
    /*catch store.action*/
    ...mapActions(['saveMoney','reduceAction','SET_AUTHORITY']),
    /*normal*/ 
    open () {
      havePower(2010);
      powerList();
      // await console.log(1)
    }
  },
  mounted(){
    
    this.SET_AUTHORITY();
  }
}
</script>

<style>
@import "./style.less"
</style>
